package com.song.provider.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
public class HelloController {

     @Value("${server.port}")
     private String port;

     @Resource
     private RestTemplate restTemplate;

     @GetMapping("/hi")
     public String hi(){
           return this.restTemplate.getForObject("http://USER-PROVIDER/hello", String.class);
     }

        @GetMapping("/hello")
        public String hello(){
            return "你好，我是User客户端的输出！端口号："+this.port;
        }
}
